#include <iostream>
#include <cstdlib>

using namespace std;

int strlen(const char* s)
{
    int len = 0;
    for (int i=0; i<1000; i++)
    {
        if (s[i] == '\0')
        {
            break;
        }
        len += 1;
    }
    return len;
}

string _reverse(const char* s, int length)
{
    if (length <= 1)
    {
        return s;
    }

    string str = string(s);
    string without_last_char = str.substr(0, length-1);
    return str.substr(length-1).append(_reverse(without_last_char.c_str(), length-1));
}

string reverse(const char* s)
{
    return _reverse(s, strlen(s));
}

int main()
{
    cout << "请输入一个字符串：" << endl;
    char s[1000];
    cin >> s;
    cout << "长度为：" << strlen(s) << endl;
    cout << reverse(s) << endl;
    return 0;
}